from aliyunsdkcore.client import AcsClient
from aliyunsdkcore.acs_exception.exceptions import ClientException
from aliyunsdkcore.acs_exception.exceptions import ServerException
from aliyunsdkcore.auth.credentials import AccessKeyCredential
from aliyunsdkcore.auth.credentials import StsTokenCredential
from aliyunsdkcdn.request.v20180510.RefreshObjectCachesRequest import RefreshObjectCachesRequest
class aliyunsdk:
    def __init__(self,access_key_id,access_key_secret):
        credentials = AccessKeyCredential(access_key_id,access_key_secret)
        self.client = AcsClient(region_id='cn-hangzhou', credential=credentials)
    def RefreshObjectCachesRequest(self,downurl):
        request = RefreshObjectCachesRequest()
        request.set_accept_format('json')
        request.set_ObjectPath(downurl)
        request.set_ObjectType("File")
        response = self.client.do_action_with_exception(request)
        return  str(response, encoding='utf-8')